package com.chuangke.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chuangke.system.dao.SysAttachmentDao;
import com.chuangke.system.entity.SysAttachment;
import com.chuangke.system.service.SysAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysAttachmentServiceImpl implements SysAttachmentService {

	@Autowired
	private SysAttachmentDao sysAttachmentDao;


	@Override
	public List<SysAttachment> getListBySubjectId(String subjectId) {
		return sysAttachmentDao.list(new QueryWrapper<SysAttachment>().lambda().eq(SysAttachment::getSubjectId,subjectId));
	}

	@Override
	public List<SysAttachment> getListBySubjectIds(List<String> subjectIds) {
		return sysAttachmentDao.list(new QueryWrapper<SysAttachment>().lambda().in(SysAttachment::getSubjectId,subjectIds));
	}

	@Override
	public void saveOrUpdateBatch(List<SysAttachment> records) {
		sysAttachmentDao.saveOrUpdateBatch(records);
	}

	@Override
	public void removeBySubjectId(String subjectId) {
		sysAttachmentDao.remove(new QueryWrapper<SysAttachment>().lambda().eq(SysAttachment::getSubjectId,subjectId));
	}

	@Override
	public void save(SysAttachment record) {
		sysAttachmentDao.save(record);
	}
}
